package demo03;

import java.io.Serializable;

public class Person implements Serializable { // 可序列化类
    private static final long serialVersionUID = 1L; // serialVersionUID：确定序列版本号
    private String name;
    private int age;
    private transient int num; // transient：该成员变量不会被序列化

    public Person() {
    }

    public Person(String name, int age, int num) {
        this.name = name;
        this.age = age;
        this.num = num;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public String toString() {
        return "Person [age=" + age + ", name=" + name + ", num=" + num + "]";
    }
}
